Imports Microsoft.VisualBasic
Imports System.Threading
Imports System.Globalization

Public Class EviPage
    Inherits Page

    Protected Overrides Sub InitializeCulture()
        Dim selectedLanguage As String = Session("selectedLanguage")
        If Not Request.QueryString("idioma") Is Nothing Then
            If Request.QueryString("idioma").ToLower = "es" Then
                selectedLanguage = "es-ES"
            Else
                selectedLanguage = "ca-ES"
            End If
        Else
            If (String.IsNullOrEmpty(selectedLanguage)) Then selectedLanguage = "ca-ES"
        End If
        Session("selectedLanguage") = selectedLanguage
        Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(selectedLanguage)
        Thread.CurrentThread.CurrentUICulture = New CultureInfo(selectedLanguage)
        Me.Theme = "EVIGreen" & Left(selectedLanguage, 2).ToUpper()
        If selectedLanguage = "ca-ES" Then
            Session("idIdioma") = "e4915e24-3016-4a23-b67b-af87f152ea28"
        Else
            Session("idIdioma") = "6759dbb8-3859-4268-89e4-eeb67be64bac"
        End If
    End Sub
End Class
